package com.sc.nft.controller;


import com.sc.nft.annotation.UserLogin;
import com.sc.nft.controller.request.IdRequest;
import com.sc.nft.entity.vo.OriginalCopyrightSellVO;
import com.sc.nft.entity.vo.OriginalCopyrightVO;
import com.sc.nft.service.SpecialEventManagementService;
import com.sc.nft.sup.PageRequest;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 专场管理(SpecialEventManagement)表控制层
 *
 * @author 王伟成
 * @since 2023-10-12 14:22:00
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("specialEventManagement")
@Api(tags = "专场管理")
public class SpecialEventManagementController {
    /**
     * 服务对象
     */
    private final SpecialEventManagementService specialEventManagementService;


    @ApiOperation(value = "版本原创", notes = "版本原创", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/originalCopyright", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public PageResult<OriginalCopyrightVO> originalCopyright(@Valid @RequestBody PageRequest pageRequest) {
        return PageResult.success(specialEventManagementService.pageOriginal(pageRequest));
    }


    @ApiOperation(value = "版本原创售卖情况", notes = "版本原创售卖情况", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/originalCopyrightSell", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public Result<List<OriginalCopyrightSellVO>> originalCopyrightSell(@RequestBody IdRequest idRequest) {
        return Result.success(specialEventManagementService.originalSell(idRequest.getId()));
    }

}
